home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / libogg / libvorbis-1.0rc3 / lib / codec_internal.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-27  |  5.3 KB  |  175 lines

  1. /********************************************************************
  2.  *                                                                  *
  3.  * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  4.  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
  5.  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  6.  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  7.  *                                                                  *
  8.  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
  9.  * by the XIPHOPHORUS Company http://www.xiph.org/                  *
  10.  *                                                                  *
  11.  ********************************************************************
  12.  
  13.  function: libvorbis codec headers
  14.  last mod: $Id: codec_internal.h,v 1.12 2001/12/20 01:00:26 segher Exp $
  15.  
  16.  ********************************************************************/
  17.  
  18. #ifndef _V_CODECI_H_
  19. #define _V_CODECI_H_
  20.  
  21. #include "envelope.h"
  22. #include "codebook.h"
  23.  
  24. #define BLOCKTYPE_IMPULSE    0
  25. #define BLOCKTYPE_PADDING    1
  26. #define BLOCKTYPE_TRANSITION 0 
  27. #define BLOCKTYPE_LONG       1
  28.  
  29. typedef struct vorbis_block_internal{
  30.   float  **pcmdelay;  /* this is a pointer into local storage */ 
  31.   float  ampmax;
  32.   int    blocktype;
  33.  
  34.   ogg_uint32_t *packet_markers;
  35. } vorbis_block_internal;
  36.  
  37. typedef void vorbis_look_time;
  38. typedef void vorbis_look_mapping;
  39. typedef void vorbis_look_floor;
  40. typedef void vorbis_look_residue;
  41. typedef void vorbis_look_transform;
  42.  
  43. /* mode ************************************************************/
  44. typedef struct {
  45.   int blockflag;
  46.   int windowtype;
  47.   int transformtype;
  48.   int mapping;
  49. } vorbis_info_mode;
  50.  
  51. typedef void vorbis_info_time;
  52. typedef void vorbis_info_floor;
  53. typedef void vorbis_info_residue;
  54. typedef void vorbis_info_mapping;
  55.  
  56. #include "psy.h"
  57. #include "bitrate.h"
  58.  
  59. typedef struct backend_lookup_state {
  60.   /* local lookup storage */
  61.   envelope_lookup        *ve; /* envelope lookup */    
  62.   float                 **window[2][2][2]; /* block, leadin, leadout, type */
  63.   vorbis_look_transform **transform[2];    /* block, type */
  64.   codebook               *fullbooks;
  65.   vorbis_look_psy_global *psy_g_look;
  66.  
  67.   /* backend lookups are tied to the mode, not the backend or naked mapping */
  68.   int                     modebits;
  69.   vorbis_look_mapping   **mode;
  70.  
  71.   /* local storage, only used on the encoding side.  This way the
  72.      application does not need to worry about freeing some packets'
  73.      memory and not others'; packet storage is always tracked.
  74.      Cleared next call to a _dsp_ function */
  75.   unsigned char *header;
  76.   unsigned char *header1;
  77.   unsigned char *header2;
  78.  
  79.   bitrate_manager_state bms;
  80.  
  81. } backend_lookup_state;
  82.  
  83. /* high level configuration information for setting things up
  84.    step-by-step with the detaile vorbis_encode_ctl interface */
  85.  
  86. typedef struct highlevel_block {
  87.   double tone_mask_quality;
  88.   double tone_peaklimit_quality;
  89.  
  90.   double noise_bias_quality;
  91.   double noise_compand_quality;
  92.  
  93.   double ath_quality;
  94.  
  95. } highlevel_block;
  96.  
  97. typedef struct highlevel_encode_setup {
  98.   double base_quality;       /* these have to be tracked by the ctl */
  99.   double base_quality_short; /* interface so that the right books get */
  100.   double base_quality_long;  /* chosen... */
  101.  
  102.   int short_block_p;
  103.   int long_block_p;
  104.   int impulse_block_p;
  105.  
  106.   int stereo_couple_p;
  107.   int stereo_backfill_p;
  108.   int residue_backfill_p;
  109.  
  110.   int    stereo_point_dB;
  111.   double stereo_point_kHz[2];
  112.   double lowpass_kHz[2];
  113.  
  114.   double ath_floating_dB;
  115.   double ath_absolute_dB;
  116.  
  117.   double amplitude_track_dBpersec;
  118.   double trigger_quality;
  119.  
  120.   highlevel_block blocktype[4]; /* impulse, padding, trans, long */
  121.   
  122. } highlevel_encode_setup;
  123.  
  124. /* codec_setup_info contains all the setup information specific to the
  125.    specific compression/decompression mode in progress (eg,
  126.    psychoacoustic settings, channel setup, options, codebook
  127.    etc).  
  128. *********************************************************************/
  129.  
  130. typedef struct codec_setup_info {
  131.  
  132.   /* Vorbis supports only short and long blocks, but allows the
  133.      encoder to choose the sizes */
  134.  
  135.   long blocksizes[2];
  136.  
  137.   /* modes are the primary means of supporting on-the-fly different
  138.      blocksizes, different channel mappings (LR or M/A),
  139.      different residue backends, etc.  Each mode consists of a
  140.      blocksize flag and a mapping (along with the mapping setup */
  141.  
  142.   int        modes;
  143.   int        maps;
  144.   int        times;
  145.   int        floors;
  146.   int        residues;
  147.   int        books;
  148.   int        psys;     /* encode only */
  149.  
  150.   vorbis_info_mode       *mode_param[64];
  151.   int                     map_type[64];
  152.   vorbis_info_mapping    *map_param[64];
  153.   int                     time_type[64];
  154.   vorbis_info_time       *time_param[64];
  155.   int                     floor_type[64];
  156.   vorbis_info_floor      *floor_param[64];
  157.   int                     residue_type[64];
  158.   vorbis_info_residue    *residue_param[64];
  159.   static_codebook        *book_param[256];
  160.  
  161.   vorbis_info_psy        *psy_param[64]; /* encode only */
  162.   vorbis_info_psy_global psy_g_param;
  163.  
  164.   bitrate_manager_info   bi;
  165.   highlevel_encode_setup hi;
  166.  
  167.   int    passlimit[32];     /* iteration limit per couple/quant pass */
  168.   int    coupling_passes;
  169. } codec_setup_info;
  170.  
  171. extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
  172. extern void _vp_global_free(vorbis_look_psy_global *look);
  173.  
  174. #endif
  175.